var express = require('express');
var router = express.Router();
var connection = require('../db/sql');
var user = require('../db/User');
var tencentcloud = require("tencentcloud-sdk-nodejs")
const jwt=require('jsonwebtoken');
let Code = "";

// 跨域设置
router.all('*', function(req, res, next) {
	res.header("Access-Control-Allow-Origin", "*");
	res.header("Access-Control-Allow-Headers", "X-Requested-With");
	res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
	res.header("X-Powered-By", ' 3.2.1');
	res.header("Content-Type", "application/json;charset=utf-8");
	next();
});

router.post('', function(req, res, next) {

});

router.post('/api/updataAddress', function(req, res, next) {
let updata=req.body.obj;
console.log(updata)
let token=req.headers.token;
let user=jwt.decode(token);
// connection.query("select * from user where phone= '"+user.name+"'",function(err,result){
// 	let userId = result[0].id;	
// 	let addSql='insert into address (name,tel,province,city,district,address,isDefault,userId) values ("'+add.name+'","'+add.tel+'","'+add.province+'","'+add.city+'","'+add.district+'","'+add.address+'","'+add.isDefault+'","'+userId+'")'
// 	// "insert into address(name,tel,province,city,district,address,isDefault,userId) values('"+add.name+"','"+add.tel+"','"+add.province+"','"+add.city+"','"+add.district"','"+add.address+"','"+add.isDefault+"','"+userId+"')"
// 	connection.query(addSql,function(e,r){
// 		res.send({
// 			data:{
// 				success:"添加成功"
// 			}
// 		})
// 	})
// })

});


router.post('/api/addAddress', function(req, res, next) {
let add=req.body.obj
let token=req.headers.token;
console.log(add)
let user=jwt.decode(token);
connection.query("select * from user where phone= '"+user.name+"'",function(err,result){
	let userId = result[0].id;	
	let addSql='insert into address (name,tel,province,city,district,address,isDefault,userId) values ("'+add.name+'","'+add.tel+'","'+add.province+'","'+add.city+'","'+add.district+'","'+add.address+'","'+add.isDefault+'","'+userId+'")'
	// "insert into address(name,tel,province,city,district,address,isDefault,userId) values('"+add.name+"','"+add.tel+"','"+add.province+"','"+add.city+"','"+add.district"','"+add.address+"','"+add.isDefault+"','"+userId+"')"
	connection.query(addSql,function(e,r){
		res.send({
			data:{
				success:"添加成功"
			}
		})
	})
})

});

router.post('/api/selectAddress', function(req, res, next) {
let token=req.headers.token;
let user=jwt.decode(token);
console.log(user.name)

connection.query("select * from user where phone= '"+user.name+"'",function(err,result){
	let userId = result[0].id;
	
	connection.query("select * from address where userId= '"+userId+"'" ,function(e,r){
		res.send({
			data:{
				data:r
			}
		})
	})
	
	
})



});

router.post('/api/loginother', function(req, res, next) {
let params={
	provider:req.body.provider,
	openId:req.body.openId,
	nickName:req.body.nickName,
	avatarUrl:req.body.avatarUrl
}
connection.query(user.queryUserName(params), function(err, result) {
			if(result.length>0){
			connection.query(user.queryUserName(params), function(er, re) {
				res.send({
					data:{
						success: true,
						msg: "登录成功",
					    data: re[0]
					}
				})
			})
			}else{
				connection.query(user.addUser(params), function(error, results, fields) {
					connection.query(user.queryUserName(params), function(er, re) {
						res.send({
							data:{
								success: true,
								msg: "登录成功",
							    data: re[0]
							}
						})
					})
				})
			}

})

});

router.post('/api/addUser', function(req, res, next) {
	let params = {
		userName: req.body.phone,
		userCode: req.body.code
	}
	if (params.userCode == Code) {
		connection.query(user.addUser(params), function(error, results, fields) {
			connection.query(user.queryUserName(params), function(err, result) {
				res.send({
					data: {
						success: true,
						msg: "注册成功",
						data: result[0]
					}
				})
			})

		})
	}

});

router.post('/api/code', function(req, res, next) {
	let params = {
		userName: req.body.phone
	}
	// 生成6位整数 （Math.random()方法生成一个介于0和0.99999之间的随机数,将其乘以 900000，得到介于 0 和 899999 之间的随机数，然后加上 100000，将其范围转换为 100000 到 999999，使用 Math.floor() 方法将结果向下取整）
	let smsCode = String(Math.floor(Math.random() * 900000) + 100000);
	Code = smsCode
	console.log(Code)
	// 接入短信的SDK
	const SmsClient = tencentcloud.sms.v20210111.Client;

	// 实例化一个认证对象，入参需要传入腾讯云账户 SecretId 和 SecretKey，此处还需注意密钥对的保密
	// 代码泄露可能会导致 SecretId 和 SecretKey 泄露，并威胁账号下所有资源的安全性。以下代码示例仅供参考，建议采用更安全的方式来使用密钥，请参见：https://cloud.tencent.com/document/product/1278/85305
	// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
	const clientConfig = {
		credential: {
			secretId: "AKIDX2OZdYPDvPp4B9tNlz1pdGfy52nJcotm",
			secretKey: "tHc5QYR3QYR7cv1yobFqFaCi4C7nERP7",
		},
		region: "ap-beijing",
		profile: {
			httpProfile: {
				endpoint: "sms.tencentcloudapi.com",
			},
		},
	};

	// 实例化要请求产品的client对象,clientProfile是可选的
	const client = new SmsClient(clientConfig);
	const paramss = {
		"PhoneNumberSet": [
			"+86" + params.userName + ""
		],
		"SmsSdkAppId": "1400809907",
		"SignName": "塔塔开的松公众号",
		"TemplateId": "1757482",
		"TemplateParamSet": [
			smsCode
		]

	};

	client.SendSms(paramss).then(
		(data) => {
			console.log(data);
			res.send({
				data: {
					success: true,
					code: smsCode
				}
			})
		},
		(err) => {
			console.error("error", err);
		}
	);
})


// 注册接口
router.post('/api/register', function(req, res, next) {
	let params = {
		userName: req.body.phone
	}
	connection.query(user.queryUserName(params), function(error, results, fields) {
		if (results.length > 0) {
			res.send({
				data: {
					success: false,
					msg: "手机号已存在"
				}
			})
		} else {
			res.send({
				data: {
					success: true,
				}
			})
		}
	});

});


// 登录接口
router.post('/api/login', function(req, res, next) {
	let params = {
		userName: req.body.userName,
		userPwd: req.body.userPwd
	}
	connection.query(user.queryUserName(params), function(error, results, fields) {
		if (results.length > 0) {
			connection.query(user.queryUserPwd(params), function(err, result) {
				if (result.length > 0) {
					res.send({
						data: {
							success: true,
							msg: "登录成功",
							data: result[0]
						}
					})
				} else {
					res.send({
						data: {
							success: false,
							msg: "密码不正确"
						}
					})
				}
			})

		} else {
			res.send({
				data: {
					success: false,
					msg: "用户名或手机号不存在"
				}
			})
		}

	})

});


// 搜索数据
router.get('/api/goods/search', function(req, res, next) {

	// req.query 是一个 Node.js 中 Express 框架中的一个属性，
	// 用于获取客户端 GET 请求中包含的查询参数。
	// 查询参数是包含在请求 URL 中的键值对

	// 声明了两个变量 goodName 和 orderName，并使用数组解构语法从某个值中提取它们的值
	let [goodName, orderName] = Object.keys(req.query);
	// 从 req.query 中提取了 name 键的值，并将其赋值给 name 变量
	let name = req.query.name;
	// 方括号表示法允许使用变量作为属性名
	let order = req.query[orderName]

	connection.query('SELECT * from goods_search where name like "%' + name + '%" order by ' + orderName + ' ' +
		order + '',
		function(error, results, fields) {
			if (error) throw error;
			res.json({
				code: '0',
				data: results
			})

		});
});
// 搜索数据
router.get('/api/goods/detail', function(req, res, next) {
	let id = req.query.id
	connection.query('SELECT * from goods_search where id=' + id + '',
		function(error, results, fields) {
			if (error) throw error;
			res.json({
				code: '0',
				data: results
			})

		});
});


// 详情数据
router.get('/api/goods/list', function(req, res, next) {
	res.json({
		code: 0,
		data: [{
				id: 1,
				name: "家居家纺",
				data: [{
						name: '家居',
						list: [{
								id: 1,
								name: '毛巾/浴巾',
								imgUrl: "../../static/img/one.jpg"
							},
							{
								id: 2,
								name: '枕头',
								imgUrl: "../../static/img/one.jpg"
							},
						]

					},
					{
						name: '生活用品',
						list: [{
								id: 1,
								name: '浴室用品',
								imgUrl: "../../static/img/one.jpg"
							},
							{
								id: 2,
								name: '洗衣机',
								imgUrl: "../../static/img/one.jpg"
							},
						]

					},

				],

			},
			{
				id: 2,
				name: "女装大佬",
				data: [{
						name: '裙装',
						list: [{
								id: 1,
								name: '半身裙',
								imgUrl: "../static/img/one.jpg"
							},
							{
								id: 2,
								name: '连衣裙',
								imgUrl: "../static/img/one.jpg"
							},
						]

					},
					{
						name: '上衣',
						list: [{
								id: 1,
								name: 'T恤',
								imgUrl: "../static/img/one.jpg"
							},
							{
								id: 2,
								name: '衬衫',
								imgUrl: "../static/img/one.jpg"
							},
						]

					},

				],

			}


		]


	})

});

// 运动户外-触底数据
router.get('/api/index_list/2/data/2', function(req, res, next) {
	res.json({
		code: '0',
		data: [{
			type: "shopList",
			data: [{
					id: 1,
					imgUrl: "../../static/image/shop.jpg",
					name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
					pprice: "$1111",
					oprice: "$999",
					discount: "5.2折"
				},
				{
					id: 2,
					imgUrl: "../../static/image/shop1.jpg",
					name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
					pprice: "$1111",
					oprice: "$999",
					discount: "5.2折"
				},
				{
					id: 3,
					imgUrl: "../../static/image/shop2.jpg",
					name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
					pprice: "$1111",
					oprice: "$999",
					discount: "5.2折"
				},
				{
					id: 4,
					imgUrl: "../../static/image/shop3.jpg",
					name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
					pprice: "$1111",
					oprice: "$999",
					discount: "5.2折"
				}

			]

		}]
	})



});
// 运动户外-触底数据
router.get('/api/index_list/2/data/3', function(req, res, next) {
	res.json({
		code: '0',
		data: [{
			type: "shopList",
			data: [{
					id: 1,
					imgUrl: "../../static/image/shop.jpg",
					name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
					pprice: "$1111",
					oprice: "$999",
					discount: "5.2折"
				},
				{
					id: 2,
					imgUrl: "../../static/image/shop1.jpg",
					name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
					pprice: "$1111",
					oprice: "$999",
					discount: "5.2折"
				},
				{
					id: 3,
					imgUrl: "../../static/image/shop2.jpg",
					name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
					pprice: "$1111",
					oprice: "$999",
					discount: "5.2折"
				},
				{
					id: 4,
					imgUrl: "../../static/image/shop3.jpg",
					name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
					pprice: "$1111",
					oprice: "$999",
					discount: "5.2折"
				}

			]

		}]
	})



});

// 首页-触底数据
router.get('/api/index_list/1/data/2', function(req, res, next) {
	res.json({
		code: '0',
		data: [{
			type: "shopList",
			data: [{
					id: 1,
					imgUrl: "../../static/image/shop.jpg",
					name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
					pprice: "$1111",
					oprice: "$999",
					discount: "5.2折"
				},
				{
					id: 2,
					imgUrl: "../../static/image/shop1.jpg",
					name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
					pprice: "$1111",
					oprice: "$999",
					discount: "5.2折"
				},
				{
					id: 3,
					imgUrl: "../../static/image/shop2.jpg",
					name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
					pprice: "$1111",
					oprice: "$999",
					discount: "5.2折"
				},
				{
					id: 4,
					imgUrl: "../../static/image/shop3.jpg",
					name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
					pprice: "$1111",
					oprice: "$999",
					discount: "5.2折"
				}

			]

		}]
	})



});

// 运动户外-分页展示
router.get('/api/index_list/2/data/1', function(req, res, next) {
	res.json({
		code: "0",
		data: [{
				type: "bannerList",
				imgUrl: "../../static/image/banner1.jpg"
			},
			{
				type: "iconList",
				data: [{
						imgUrl: '../../static/img/ic_跑步鞋.png',
						name: "跑步鞋"
					},
					{
						imgUrl: '../../static/img/篮球鞋.png',
						name: "篮球鞋"
					},
					{
						imgUrl: '../../static/img/运动鞋.png',
						name: "运动鞋"
					},
					{
						imgUrl: '../../static/img/户外鞋.png',
						name: "户外鞋"
					},
					{
						imgUrl: '../../static/img/运动T.png',
						name: "运动T"
					},
					{
						imgUrl: '../../static/img/夹克.png',
						name: "夹克"
					},
					{
						imgUrl: '../../static/img/运动裤.png',
						name: "运动裤"
					},
					{
						imgUrl: '../../static/img/连衣裤.png',
						name: "连衣裤"
					}
				]
			},

			{
				type: "hotList",
				data: [{
						id: 1,
						imgUrl: "../../static/image/hot1.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					},
					{
						id: 2,
						imgUrl: "../../static/image/hot2.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					},
					{
						id: 3,
						imgUrl: "../../static/image/hot3.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					}

				]
			},
			{
				type: "storeList",
				data: [{
						bigImg: "../../static/image/banner1.jpg",
						data: [{
								id: 1,
								imgUrl: "../../static/image/shop1.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							},
							{
								id: 2,
								imgUrl: "../../static/image/shop2.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							},
							{
								id: 3,
								imgUrl: "../../static/image/shop3.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							},
							{
								id: 4,
								imgUrl: "../../static/image/shop4.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							}

						]
					},

					{
						bigImg: "../../static/image/banner1.jpg",
						data: [{
								id: 1,
								imgUrl: "../../static/image/shop1.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							},
							{
								id: 2,
								imgUrl: "../../static/image/shop2.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							},
							{
								id: 3,
								imgUrl: "../../static/image/shop3.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							},
							{
								id: 4,
								imgUrl: "../../static/image/shop4.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							}
						]
					}
				]

			},
			{
				type: "shopList",
				data: [{
						id: 1,
						imgUrl: "../../static/image/shop1.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					},
					{
						id: 2,
						imgUrl: "../../static/image/shop2.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					},
					{
						id: 3,
						imgUrl: "../../static/image/shop3.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					},
					{
						id: 4,
						imgUrl: "../../static/image/shop4.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					}

				]
			}

		]
	})

});

// 服饰内衣-分页展示
router.get('/api/index_list/3/data/1', function(req, res, next) {
	res.json({
		code: "0",
		data: [{
				type: "bannerList",
				imgUrl: "../../static/image/banner1.jpg"
			},
			{
				type: "iconList",
				data: [{
						imgUrl: '../../static/img/ic_跑步鞋.png',
						name: "跑步鞋"
					},
					{
						imgUrl: '../../static/img/篮球鞋.png',
						name: "跑步鞋"
					},
					{
						imgUrl: '../../static/img/运动鞋.png',
						name: "跑步鞋"
					},
					{
						imgUrl: '../../static/img/户外鞋.png',
						name: "户外鞋"
					},
					{
						imgUrl: '../../static/img/运动T.png',
						name: "运动T"
					},
					{
						imgUrl: '../../static/img/夹克.png',
						name: "夹克"
					},
					{
						imgUrl: '../../static/img/运动裤.png',
						name: "运动裤"
					},
					{
						imgUrl: '../../static/img/连衣裤.png',
						name: "连衣裤"
					}
				]
			},

			{
				type: "hotList",
				data: [{
						id: 1,
						imgUrl: "../../static/image/hot1.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					},
					{
						id: 2,
						imgUrl: "../../static/image/hot2.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					},
					{
						id: 3,
						imgUrl: "../../static/image/hot3.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					},
				]
			},
			{
				type: "storeList",
				data: [{
						bigImg: "../../static/image/banner1.jpg",
						data: [{
								id: 1,
								imgUrl: "../../static/image/sho1.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							},
							{
								id: 2,
								imgUrl: "../../static/image/shop2.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							},
							{
								id: 3,
								imgUrl: "../../static/image/shop3.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							},
							{
								id: 4,
								imgUrl: "../../static/image/shop4.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							}
						]
					},
					{
						bigImg: "../../static/image/banner1.jpg",
						data: [{
								id: 1,
								imgUrl: "../../static/image/shop1.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							},
							{
								id: 2,
								imgUrl: "../../static/image/shop2.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							},
							{
								id: 3,
								imgUrl: "../../static/image/shop3.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							},
							{
								id: 4,
								imgUrl: "../../static/image/shop4.jpg",
								name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
								pprice: "$1111",
								oprice: "$999",
								discount: "5.2折"
							}
						]
					}
				]

			},
			{
				type: "shopList",
				data: [{
						id: 1,
						imgUrl: "../../static/image/shop1.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					},
					{
						id: 2,
						imgUrl: "../../static/image/shop2.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					},
					{
						id: 3,
						imgUrl: "../../static/image/shop3.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					},
					{
						id: 4,
						imgUrl: "../../static/image/shop4.jpg",
						name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
						pprice: "$1111",
						oprice: "$999",
						discount: "5.2折"
					}

				]
			}

		]

	})

});

// 推荐-首页
router.get('/api/index_list/data', function(req, res, next) {
	res.json({
		"code": 0,
		"data": {
			topBar: [{
					id: 1,
					name: "推荐"
				},
				{
					id: 2,
					name: "运动户外"
				},
				{
					id: 3,
					name: "服饰内衣"
				},
				{
					id: 4,
					name: "鞋靴箱包"
				},
				{
					id: 5,
					name: "美妆个护"
				},
				{
					id: 6,
					name: "家具数码"
				},
				{
					id: 7,
					name: "视频母婴"
				}
			],
			data: [{
					type: "swiperList",
					data: [{
							"imgUrl": "../../static/image/swiper1.jpg"
						},
						{
							"imgUrl": "../../static/image/swiper2.jpg"
						},
						{
							"imgUrl": "../../static/image/swiper3.jpg"
						}
					]
				},

				{
					type: "showList",
					data: [{
							bigUrl: "../../static/image/Children.jpg",
							data: [{
									imgUrl: "../../static/image/shop.jpg"
								},
								{
									imgUrl: "../../static/image/shop1.jpg"
								},
								{
									imgUrl: "../../static/image/shop2.jpg"
								}
							]
						},
						{
							bigUrl: "../../static/image/banner1.jpg",
							data: [{
									imgUrl: "../../static/image/shop.jpg"
								},
								{
									imgUrl: "../../static/image/shop1.jpg"
								},
								{
									imgUrl: "../../static/image/shop2.jpg"
								}
							]
						},

					]
				},
				{
					type: "shopList",
					data: [{
							id: 1,
							imgUrl: "../../static/image/shop1.jpg",
							name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
							pprice: "$1111",
							oprice: "$999",
							discount: "5.2折"
						},
						{
							id: 2,
							imgUrl: "../../static/image/shop2.jpg",
							name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
							pprice: "$1111",
							oprice: "$999",
							discount: "5.2折"
						},
						{
							id: 3,
							imgUrl: "../../static/image/shop3.jpg",
							name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
							pprice: "$1111",
							oprice: "$999",
							discount: "5.2折"
						},
						{
							id: 4,
							imgUrl: "../../static/image/shop4.jpg",
							name: "爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款爆款",
							pprice: "$1111",
							oprice: "$999",
							discount: "5.2折"
						}


					]
				}
			]
		}

	});

});

module.exports = router;